import React, { Component } from 'react'
import { Result, Button } from 'antd'
import { connect } from 'react-redux'
@connect(
  (state) => ({ title: state.title }),
  (dispatch) => ({
    setTitle: (title) => dispatch({ type: 'setTitle', data: title }),
  })
)
class Error404 extends Component {
  componentDidMount() {
    this.props.setTitle('未知页面')
  }
  backHome = () => {
    this.props.setTitle('首页')
    this.props.history.replace('/home')
  }
  render() {
    return (
      <Result
        style={{ height: '100%' }}
        status="404"
        title="404"
        subTitle="很抱歉, 您浏览的网页不存在，请点击返回主页."
        extra={
          <Button type="primary" onClick={this.backHome}>
            返回主页
          </Button>
        }
      />
    )
  }
}
export default Error404
